-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ENH: Give more informative file format errors #1165
Conversation
@@ -491,7 +494,7 @@ def _format_from_contents(self) -> FileFormat: | |||
self.file.seek(mark) | |||
else: | |||
if not self.exists(): | |||
raise ValueError(f"File {self.name} does not exist") | |||
raise FileNotFoundError(f"File {self.name} does not exist") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bonus exception type change
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #1165 +/- ##
==========================================
- Coverage 80.08% 80.06% -0.02%
==========================================
Files 97 97
Lines 13612 13634 +22
Branches 2186 2187 +1
==========================================
+ Hits 10901 10916 +15
- Misses 1981 1988 +7
Partials 730 730 ☔ View full report in Codecov by Sentry. |
0773769
to
844e3c6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comments, otherwise 👍
844e3c6
to
335dbff
Compare
This will list some potential file formats, which are not complete in their file extensions permutations but should be sufficient enough to give a hint as to what kind of required.
335dbff
to
b51d79e
Compare
[ | ||
FileFormat.ROFF_BINARY, | ||
FileFormat.ROFF_ASCII, | ||
FileFormat.EGRID, | ||
FileFormat.FEGRID, | ||
FileFormat.GRDECL, | ||
FileFormat.BGRDECL, | ||
FileFormat.XTG, | ||
FileFormat.HDF, | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally in #1164 this list becomes a property of the different class types, or something like that.
Resolves #706
This will list some potential file formats, which are not complete in their file extensions permutations but should be sufficient enough to give a hint as to what kind of required.